//
//  QGComposeTypeButton.swift
//  斯威夫特微博
//
//  Created by youyoumacmini3 on 2017/7/31.
//  Copyright © 2017年 youyoumacmini3. All rights reserved.
//

import UIKit

// UIControl 内置了 touchupInside 事件响应
class QGComposeTypeButton: UIControl {

    @IBOutlet weak var imageView: UIImageView!
    @IBOutlet weak var titleLabel: UILabel!
  
    // 点击按钮要展现控制器类名
    var clsName: String?
    

    /// 使用图像名称和标题创建按钮，按钮布局从 XIB 加载
    class func composeTypeButton(imageName: String, title: String) -> QGComposeTypeButton {
        let nib = UINib(nibName: "QGComposeTypeButton", bundle: nil)
        let btn = nib.instantiate(withOwner: nil, options: nil)[0] as! QGComposeTypeButton
        
        btn.imageView.image = UIImage(named: imageName)
        btn.titleLabel.text = title
        
        return btn
    }
    
}
